import sys
import fileinput

import argparse


parser = argparse.ArgumentParser()
parser.add_argument("textToReplace", help="text To Replace")
args = parser.parse_args()

textToReplace=args.textToReplace

out=textToReplace+"_client.py"
textToSearch="nnnnnnnnn"


with open(out, 'w') as f:
    print(
        '''


import time
import grpc

import nnnnnnnnn_pb2
import nnnnnnnnn_pb2_grpc

def run():
  channel = grpc.insecure_channel('localhost:50051')
  stub = nnnnnnnnn_pb2_grpc.grpc_service_nnnnnnnnnStub(channel)
  response_set = stub.setnnnnnnnnn(nnnnnnnnn_pb2.nnnnnnnnnSetRequest(nnnnnnnnn_request=nnnnnnnnn_pb2.nnnnnnnnn(nnnnnnnnn_key="zz",nnnnnnnnn_value="2")))
  response_get = stub.getnnnnnnnnn(nnnnnnnnn_pb2.nnnnnnnnnGetRequest(nnnnnnnnn_key="zz"))
  print(response_set)
  print(response_get)


if __name__ == '__main__':
  run()




''', file=f)
with fileinput.FileInput(out, inplace=True) as file:
    for line in file:
        print(line.replace(textToSearch, textToReplace), end='')